module.exports = function (args) {
    const {ESLintPlugin, StylelintWebpackPlugin} = args
    return {
        devtool: 'eval-source-map',
        devServer: {
            port: 8080,
            hot: true, // 只是针对css
            open: false,
            host: '0.0.0.0',
            historyApiFallback: true,
            proxy: [{
                context: '/api',
                target: "http://localhost:3000",
                changeOrigin: true,
                pathRewrite: {
                    '^/api': '',
                },
            }],
        },
        plugins: [
            new StylelintWebpackPlugin({
                files: ['src/**/*.css', 'src/**/*.scss'],
                extensions: ['css', 'less', 'vue', 'html'],
                fix: true,
                threads: true,
                cache: true,
            }),
            new ESLintPlugin({
                files: ['src/**/*.ts', 'src/**/*.js'],
                extensions: ['js', 'ts'],
                fix: true,
                threads: true,
                cache: true,
            })
        ]
    }
}
